Release 10.1A: OpenEdge Development:
ProDataSets


ProDataSets and temp-tables

The Progress temp-table already provides a large measure of support for managing sets of data independent of the database. Because the ProDataSet is in many ways an extension of that support, it’s worth briefly reviewing some of the temp-table characteristics that are also part of the ProDataSet.

Temp-tables compared to database tables

A temp-table allows you to define a table that is not part of any persistent database. You can use temp-tables within a session or pass them between sessions. Temp-tables provide in-memory buffering of data and transparent overflow to a temporary database on disk when necessary. You can define a temp-table as being LIKE a database table, and you can add fields of any type to this definition, or you can define the table as a set of fields independent of any particular database table. You can create, read, update, and delete records in the temp-table much as you can with records in a database table. You can define indexes to manage large sets of data efficiently. You can access the records in the table with FIND and FOR EACH logic or with queries.

Static or dynamic temp-tables

You can define a temp-table in a static definition, specifying all its fields and indexes in a single statement. You can also create a temp-table as a dynamic object with a handle and then add fields, buffers, and indexes to it in individual successive statements, finalizing the temp-table structure with a TEMP-TABLE-PREPARE method. You can also retrieve the handle to a static temp-table and then access its attributes, the same as you can a dynamic temp-table, in order to see what fields and indexes it contains, what its default buffer is, and so forth.

Passing temp-tables

You can pass a temp-table between procedures within a session or between sessions, such as between a server session that loads database data into the table and a client session that views the data and perhaps allows changes. You can pass a temp-table as a static parameter and receive it as a static or dynamic object. You can also pass a dynamic temp-table and receive it as either a static or dynamic object.

In all these cases, the names of the tables and fields do not need to match on the two sides of the call. Only the essentials of the field definitions—their number, sequence, and data types—need to match. Field names along with the format and other attributes can be different, as can index definitions, because indexes are rebuilt as the temp-table is received.

In addition, you can pass a temp-table by HANDLE, in which case only the handle as a pointer to either a static or dynamic temp-table is passed. Nothing is copied from caller to callee. Because handles are not valid between sessions, and because there is no way to share either the definition or data across sessions without copying it, the HANDLE form can be used only between procedures in the same session.

ProDataSet comparison

A ProDataSet is constructed from multiple temp-tables and shares and extends all of these temp-table characteristics:


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095